import 'package:fl_chart/fl_chart.dart';
import 'package:get/get.dart';

import 'radar_chart1_state.dart';

class RadarChart1Logic extends GetxController {
  final RadarChart1State state = RadarChart1State();

  void angleValue(double value) {
    state.angleValue = value;
    update();
  }

  void relativeAngleMode(v) {
    state.relativeAngleMode = v!;
    update();
  }

  void categories() {
    state.selectedDataSetIndex = -1;
    update();
  }

  void rawDataItem(index) {
    state.selectedDataSetIndex = index;
    update();
  }

  void touchCallback(FlTouchEvent event, response) {
    if (!event.isInterestedForInteractions) {
      state.selectedDataSetIndex = -1;
      return;
    }
    state.selectedDataSetIndex =
        response?.touchedSpot?.touchedDataSetIndex ?? -1;
    update();
  }
}
